home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Softdisk Supreme
/
Softdisk Supreme.iso
/
pc
/
DSK Files
/
0-49
/
SD005b.dsk
/
ALIGN.bas
< prev
next >
Wrap
BASIC Source File
|
2003-06-12
|
2KB
|
77 lines
100 REM -------------------
110 REM ALIGN DEMONSTRATION
120 REM FOR MONITOR OUTPUT
130 REM BY ERIC MARKS
140 REM -------------------
150 DIM N(10)
160 DIM N$(10)
170 HOME : VTAB 10
180 PRINT "UNALIGNED"; TAB( 27);"ALIGNED": PRINT
190 REM
200 REM READ NUMBERS TO BE
210 REM ALIGNED INTO ARRAY
220 REM N(X)
230 REM
240 FOR X = 1 TO 10
250 READ N(X)
260 NEXT X
270 REM
280 REM
290 REM PRINT THE UNALIGNED
300 REM NUMBERS AT THE LEFT
310 REM MARGIN. THEN
320 REM CONVERT NUMBERS TO
330 REM THEIR STR$ EQUIV-
340 REM ALENT, AND PASS THEM
350 REM THROUGH THE ALIGN
360 REM SUBROUTINE.
370 REM
380 REM THE ALIGN SUBROUTINE
390 REM IS AT STATEMENT 730.
400 REM IT COUNTS THE NUMBER
410 REM OF DIGITS BEFORE THE
420 REM DECIMAL POINT (AND
430 REM ALLOWS FOR THE CASE
440 REM WHERE THERE IS NO
450 REM DECIMAL POINT).
460 REM
470 REM THE NUMBER OF DIGITS
480 REM IS SAVED IN VARIABLE
490 REM -I-. TAB(30) IS WHERE
500 REM THE ALIGNED NUMBER'S
510 REM DECIMAL POINT WILL
520 REM BE PRINTED ON THE
530 REM MONITOR SCREEN. SO
540 REM IN STATEMENT 670, THE
550 REM NUMBER IS PRINTED AT
560 REM TAB(30-I). THIS HAS
570 REM THE EFFECT OF 'BACK-
580 REM SPACING' BY -I- PRINT
590 REM POSITIONS FROM THE
600 REM CHOSEN TAB SETTING.
610 REM
620 REM
630 FOR X = 1 TO 10
640 PRINT N(X);
650 N$(X) = STR$(N(X))
660 GOSUB 730
670 PRINT TAB( 30 -I);N(X)
680 NEXT X
690 END
700 REM -----
710 REM ALIGN
720 REM -----
730 LET I = 0
740 LET I = I +1
750 IF I = LEN(N$(X)) AND MID$ (N$(S),I,1) < >"." THEN I = I +1: GOTO 770
760 IF MID$ (N$(X),I,1) < >"." THEN 740
770 RETURN
780 REM
790 REM
800 REM ----------------------
810 REM DATA FOR DEMONSTRATION
820 REM ----------------------
830 DATA 25, 356.002153,-17.01525
840 DATA 3610.0013,4.177,9266
850 DATA 35.0101,-3.101,67.9199
860 DATA 3.25E-10